//
//  TTLoginViewController.m
//  TTBaseProject
//
//  Created by shny588 on 16/7/21.
//  Copyright © 2016年 tt. All rights reserved.
//

#import "TTLoginViewController.h"
#import "TTInitUI.h"

@interface TTLoginViewController ()

@end

@implementation TTLoginViewController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIButton *button = [UIButton buttonWithType:0];
    [button setTitle:@"Login" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.backgroundColor = [UIColor blueColor];
    [button addTarget:self action:@selector(loginAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left).offset(20);
        make.right.equalTo(self.view.mas_right).offset(-20);
        make.bottom.equalTo(self.view.mas_bottom).offset(-50);
        make.height.equalTo(@(50));
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - method
- (void)loginAction:(UIButton *)button {
    TTAccount *account = [[TTAccount alloc] init];
    account.userId = @"11111";
    account.userName = @"我是默认用户";
    account.phone = @"15036099717";
    [[TTAccountService shared] setDefaultAccount:account];
    
    [[TTInitUI shared] initUI:nil];
}

@end
